<template>
    <div class="dome">
        <h2>学校名称：{{schoolName}}</h2>
        <h2>学校地址：{{address}}</h2>
        <button @click="sendmsg">点我给父组件app传递学校名称</button>
    </div>
</template>

<script>
export default {
    name:'School',
    data() {
        return {
            schoolName:'尚硅谷',
            address:'深圳'
        }
    },    
    methods: {
        sendmsg(){
            console.log("已将学校名字传递给app组件")
            this.getSchoolName(this.schoolName)
        }
    },
    props:['getSchoolName']
}
</script>

<style>
    .dome{
        background-color:grey;
        margin: 30px 0;
    }
</style>